class: center, middle, inverse, title-slide .title[ # ISA 401/501: Business Intelligence & Data Visualization ] .subtitle[ ## 19: Charts Used Time-Series, Spatial and Spatiotemporal Data ] .author[ ###
Fadel M. Megahed, PhD
Enders Associate Professor
Farmer School of Business
Miami University
@FadelMegahed
fmegahed
fmegahed@miamioh.edu
Automated Scheduler for Office Hours
] .date[ ### Fall 2022 ] --- # Recap of Assignment 14 Let us discuss why the majority of submitted solutions to [Assignment 14](https://miamioh.instructure.com/courses/179812/assignments/2241032) are incorrect. Here is an example of [incorrect_submission](https://miamioh.instructure.com/courses/179812/files/25834964?module_item_id=4065700). --- # Learning Objectives for Today's Class - Understand main goals behind visualizing time-series data - Explain the different types of charts for univariate and multivariate time-series - Explain the different types of spatial plots - Select suitable spatial graphs for different scenarios - Understand how spatiotemporal plots can help in storytelling (what makes BI special) --- class: inverse, center, middle # Types of Data Over Time --- # Cross Sectional Data **Cross Sectional Data:** Measurements on multiple units, recorded in a single time period. **Example 1:** H1B 2020-2022 Data for Senior Data Scientists at Netflix
.footnote[ <html> <hr> </html> Data scraped from <https://h1bdata.info/index.php?em=Netflix+Inc&job=Senior+Data+Scientist&city=LOS+GATOS&year=All+Years> on October 25, 2022 using the [rvest](https://cran.r-project.org/web/packages/rvest/rvest.pdf)
. The printing was limited to those individuals who started on/after January 01, 2020, with the filters specified in the URL. ] --- count:: false # Cross Sectional Data **Cross Sectional Data:** Measurements on multiple units, recorded in a single time period. **Example 2:** NBA 2022-2023 Leaders - Top Players in PTS/Game
.footnote[ <html> <hr> </html> **Source:** Data scraped from <https://www.basketball-reference.com/leagues/NBA_2023_per_game.html}{Basketball-Reference> on October 25, 2022 using the [rvest](https://cran.r-project.org/web/packages/rvest/rvest.pdf)
. The printing was limited to the selected variables. ] --- # Time Series Data **Time Series Data:** Comparable measurements recorded on a single (or a few) variables over time (usually a long period of time). **Example 2:** Stock prices of U.S. Airlines <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/timeseries2-1.png" height="400px" style="display: block; margin: auto;" /> --- # Panel Data **Panel Data:** Cross sectional measurements (usually many variables) repeated over time (usually over a few time periods). **Example:** World Bank's Data
.footnote[ <html> <hr> </html> **Source:** Data queried from the [World Bank Data](https://datacatalog.worldbank.org/) using the [wbstats](https://cran.r-project.org/web/packages/wbstats/wbstats.pdf)
in R. The printed results show a snapshot of 7 variables (out of a much larger panel dataset). You can think of panel data as a cross-sectional dataset with a longitudinal/time component. ] --- class: inverse, center, middle # Components of a Time Series --- # Trend A **trend** is an increasing or decreasing pattern over time. <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/trendUP-1.png" style="display: block; margin: auto;" /> --- count:false # Trend A **trend** is an increasing or decreasing pattern over time. <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/trendDown-1.png" style="display: block; margin: auto;" /> --- # Seasonality **Seasonality** refers to the property of a time series that displays REGULAR patterns that repeat at a constant frequency (*m*). <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/airpassengers-1.png" style="display: block; margin: auto;" /> --- # Cycle **Cyclical fluctuations** are somewhat irregular (unknown duration). <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/autoSales-1.png" style="display: block; margin: auto;" /> --- class: inverse, center, middle # The Goals Behind Visualizing (Time Series) Data --- # Exploratory vs Confirmatory Viz Goals > _Visualizations can be used to explore data, to confirm a hypothesis, or to manipulate a viewer. . . In exploratory visualization the user does not necessarily know what he is looking for. This creates a dynamic scenario in which interaction is critical. . . In a confirmatory visualization, the user has a hypothesis that needs to be tested. This scenario is more stable and predictable. System parameters are often predetermined._ -- [(Grinstein and Ward 2001, 22)](https://www.google.com/books/edition/Information_Visualization_in_Data_Mining/rYFvnyPRwkgC?hl=en&gbpv=1&dq=Grinstein%2C%20Georges%20G%2C%20and%20Matthew%20O%20Ward.%202001.%20%E2%80%9CIntroduction%20to%20Data%20Visualization.%E2%80%9D%20In%20Information%20Visualization%20in%20Data%20Mining%20and%20Knowledge%20Discovery%2C%20edited%20by%20Usama%20Fayyad%2C%20Georges%20G%20Grinstein%2C%20and%20Andreas%20Wierse%2C%2021%E2%80%9345.%20San%20Francisco%2C%20CA%3A%20Morg&pg=PA22&printsec=frontcover) --- # A Structured Approach for Time Series Viz <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/ts_plots_flow_chart.png" alt="A Potential Framework for Time Series Visualization" width="100%" /> <p class="caption">A Potential Framework for Time Series Visualization</p> </div> .footnote[ <html> <hr> </html> This is my best attempt to improve on the general advice provided in the previous slide. Many of the suggestions, presented in this flow chart, stem from my past and current research/consulting collaborations. They are by no means a comprehensive list of everything that you can do. ] --- # Singular TS <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/tsSingularPlot-1.png" style="display: block; margin: auto;" /> --- # Looking for Trends <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/trends-1.png" style="display: block; margin: auto;" /> --- # Looking for Seasonality <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/seasonal1-1.png" style="display: block; margin: auto;" /> --- # Multiple TS: Scatterplots <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/german1-1.png" style="display: block; margin: auto;" /> --- # Multiple TS: Scatterplot Matrix <img src="data:image/png;base64,#19_temporal_spatial_and_spatiotemporal_charts_files/figure-html/german2-1.png" style="display: block; margin: auto;" /> --- # Multiple TS: Panel Plots <img src="data:image/png;base64,#../../figures/motivationPlot.png" width="100%" style="display: block; margin: auto;" /> --- # Spaghetti Plots (Often w/ Clustering) <img src="data:image/png;base64,#../../figures/spaghetti-1.png" width="80%" style="display: block; margin: auto;" /> --- # Summary Plots (Often w/ Clustering) <img src="data:image/png;base64,#../../figures/summaryPlot-1.png" width="80%" style="display: block; margin: auto;" /> --- class: inverse, center, middle # Spatial Plots --- # Choropleth Maps Maps where areas are **shaded, colored, or patterned** relative to a data attribute value. <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/ch1.png" alt="Charles Dupin's Illiteracy in France Choropleth, created in 1826" width="40%" height="40%" /> <p class="caption">Charles Dupin's Illiteracy in France Choropleth, created in 1826</p> </div> --- count: false # Choropleth Maps Maps where areas are **shaded, colored, or patterned** relative to a data attribute value. <div class="figure" style="text-align: center">
<p class="caption">Population Density in U.S.</p> </div> --- # Cartograms A cartogram is a map in which **areas are scaled and distorted relative to a data attribute value** <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/cart1.png" alt="The First Cartogram – Emile Levasseur, 1868" width="40%" height="40%" /> <p class="caption">The First Cartogram – Emile Levasseur, 1868</p> </div> --- count: false # Cartograms A cartogram is a map in which **areas are scaled and distorted relative to a data attribute value** <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/cart2.png" alt="The NYT's U.S. House Election Results 2018" width="50%" height="50%" /> <p class="caption">The NYT's U.S. House Election Results 2018</p> </div> --- # Proportional Symbols Map <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/prop1.png" alt="The NYT's U.S. Coverage of the Bush Vs Kerry Presidential Elections" width="70%" height="70%" /> <p class="caption">The NYT's U.S. Coverage of the Bush Vs Kerry Presidential Elections</p> </div> --- count: false # Proportional Symbols Map <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/prop4.png" alt="The NYT's U.S. Coverage of 2009 Super Bowl" width="63%" height="63%" /> <p class="caption">The NYT's U.S. Coverage of 2009 Super Bowl</p> </div> --- class: inverse, center, middle # Spatiotemporal Maps --- # Spatiotemporal Maps <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/crash_anim.gif" alt="A visualization of car crashes in the Cincinnati metro area" /> <p class="caption">A visualization of car crashes in the Cincinnati metro area</p> </div> --- count: false # Spatiotemporal Maps <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#../../figures/animatedVaccineMap.gif" alt="COVID vaccination rates per county as reported by the CDC" width="70%" height="70%" /> <p class="caption">COVID vaccination rates per county as reported by the CDC</p> </div> --- class: inverse, center, middle # Software Demo --- # Exploring the Cincy Crashes Dataset Let us use Tableau to explore the [cincy_2021_crashes.csv](https://miamioh.instructure.com/courses/179812/files/25834856?module_item_id=4065679), where we will create the following: - A calculated field titled `unique_count` - A plot of the total number of unique crashes per day - A table of number of unique crashes by week day - A table of number of unique crashes by week day - An animated symbols map --- class: inverse, center, middle # Recap --- # Summary of Main Points - Understand main goals behind visualizing time-series data - Explain the different types of charts for univariate and multivariate time-series - Explain the different types of spatial plots - Select suitable spatial graphs for different scenarios - Understand how spatiotemporal plots can help in storytelling (what makes BI special)